Skip to content

Fix protovalidate runtime examples - #43

Merged
emcfarlane merged 1 commit into
bufbuild:mainfrom
stefanvanburen:svanburen/fix-protovalidate-runtime-examples
Nov 17, 2026
Merged

emcfarlane merged 1 commit into
bufbuild:mainfrom
stefanvanburen:svanburen/fix-protovalidate-runtime-examples

Conversation

@stefanvanburen

Copy link
Copy Markdown
Contributor

Noticed the Go example in the protovalidate reference was still importing github.com/bufbuild/protovalidate-go (which now declares itself as buf.build/go/protovalidate, so go get fails), and the TypeScript one was calling validate without the schema. Fixed both, plus a couple other small things I noticed while checking the rest of the file.

(I compiled every proto snippet in the file against the current protovalidate module and ran it through protovalidate-go v1.4.0 — everything else checked out, apart from isHostAndPort(), which needs its bool argument.)

The Go example imported `github.com/bufbuild/protovalidate-go`, which
now declares its module path as `buf.build/go/protovalidate`, and
didn't compile (`err` from `protovalidate.New` was unused). Use the
package-level `protovalidate.Validate` instead.

The TypeScript example called `validate` without the message schema,
which v1 requires, and treated the result as a list of violations.

Also:

- Document `isHostAndPort`'s required `port_required` argument; calling
  it with none fails to compile.
- Describe protovalidate as evaluating rules at runtime rather than
  through generated code.
- Add the missing sections to the table of contents.
@stefanvanburen
stefanvanburen force-pushed the svanburen/fix-protovalidate-runtime-examples branch from c1a90d4 to 5c17b7c Compare November 17, 2026 20:28
@emcfarlane
emcfarlane merged commit 5c08b2a into bufbuild:main Nov 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants